package com.cw.controller;

import com.cw.common.api.Response;
import com.cw.common.api.ResultObject;
import com.cw.dto.HandworkPrepayinDto;
import com.cw.dto.RjszDTO;
import com.cw.dto.VYqBrdjxxCondition;
import com.cw.dto.VyqBrdjxxVeiwCondition;
import com.cw.service.RjbfCenterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@Api(tags = {"日间病房中心"})
@RequestMapping("/RjbfCenterController")
@RestController
public class RjbfCenterController {

    @Autowired
    private RjbfCenterService rjbfCenterService;

    @ApiOperation("日间手术列表")
    @PostMapping("/getVYqBrdjxxRJSSPagesInfo")
    public ResultObject getVYqBrdjxxRJSSPagesInfo(@RequestBody VYqBrdjxxCondition condition) {
        return ResultObject.successReturn(rjbfCenterService.getVYqBrdjxxRJSSPagesInfo(condition));
    }

    @ApiOperation("日间手术详情")
    @PostMapping("/getRJSSVYqBrdjxx")
    public ResultObject getRJSSVYqBrdjxx(@RequestBody VyqBrdjxxVeiwCondition condition) {
        return ResultObject.successReturn(rjbfCenterService.getRJSSVYqBrdjxx(condition));
    }

    @ApiOperation(value = "预约")
    @PostMapping("/addPatientBed")
    public Response addPatientBed(@RequestBody RjszDTO entity) {
        return rjbfCenterService.addPatientBed(entity);
    }

    @ApiOperation(value = "取消预约")
    @GetMapping("/delPatientBed")
    public Response delPatientBed(@RequestParam String id,@RequestParam String operName) {
        return rjbfCenterService.delPatientBed(id,operName);
    }

    @ApiOperation(value = "取消预约（his作废住院证重开,调此接口）")
    @PostMapping("/cancellation")
    public Response cancellation(@RequestParam String preId) {
        return rjbfCenterService.cancellation(preId);
    }


    @ApiOperation(value = "完成输注")
    @GetMapping("/updatePatientBed")
    public Response updatePatientBed(String id){
        return rjbfCenterService.updatePatientBed(id);
    }


    @ApiOperation(value = "根据preid查询日间患者信息")
    @GetMapping("/getIiPrepayinByIdRJ")
    public ResultObject getIiPrepayinByIdRJ(BigDecimal preid) {
        return ResultObject.successReturn(rjbfCenterService.getIiPrepayinByIdRJ(preid));
    }

    @ApiOperation(value = "查询可预约日间输注")
    @GetMapping("/searchRJSZ")
    public ResultObject searchRJSZ() {
        return ResultObject.successReturn(rjbfCenterService.searchRJSZ());
    }

    @ApiOperation(value = "查询可预约日间手术")
    @GetMapping("/searchRJSS")
    public ResultObject searchRJSS() {
        return ResultObject.successReturn(rjbfCenterService.searchRJSS());
    }

    @ApiOperation("自己本系统的手工电子住院证")
    @PostMapping("/getHandworkPrepayin")
    public ResultObject getHandworkPrepayin(@RequestBody HandworkPrepayinDto handworkPrepayinDto){
        return ResultObject.successReturn(rjbfCenterService.getHandworkPrepayin(handworkPrepayinDto));
    }

    @ApiOperation("日间手术列表下载")
    @PostMapping("/getVYqBrdjxxRJSSDownLoad")
    public void getVYqBrdjxxRJSSDownLoad(@RequestBody VYqBrdjxxCondition condition){
        rjbfCenterService.getVYqBrdjxxRJSSDownLoad(condition);
    }
}
